﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SalesInvoiceView.aspx.cs" Inherits="Main_ServiceInvoice_SalesInvoiceView" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Sale Invoice View</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript">

        function OpenInvoiceWindow(ddlId, invoiceId, tranId,type) {
            var ddl = document.getElementById(ddlId);
            if (ddl.options[ddl.selectedIndex].value == '0') {
                alert('Specify View type');
                document.getElementById(ddlId).focus();
                return false;
            }
            else {
                if (type == "view") {
                    var ViewType = ddl.options[ddl.selectedIndex].text;
                    window.open('SalesInvoiceReport.aspx?INVOICEID=' + invoiceId + '&TRANID=' + tranId + '&ViewType=' + ViewType, '', 'width=800px,height=600px,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,top=50,left=50,');
                    return true;
                }
                else if (type == "pdf") {
                document.getElementById("hidddltext").value = ddl.options[ddl.selectedIndex].text;
                }
                
            }
        }       
         
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <acc:heading ID="pagehead" runat="server" HeadingText="Sale Invoice View" />
    <asp:HiddenField ID="hidrowindex" runat="server" />
    <asp:HiddenField ID="hidddltext" runat="server" />
    <div style="width:90%; margin-left:5%; margin-right:5%">
    <div style=" padding-top:15px; padding-bottom:5px; margin-left:30%;">  
        <div style="float:left;">
            <custom:Pager ID="custPager" runat="server" OnPageChanged="custPager_PageChanged" />
        </div>
        <div style="float:left; margin-left:10px;">  
            <MyControls:CommonControls ID="CommonControls2" runat="server" GridviewControlId="grdDisplay" HideColumns="6,7,8" /> 
        </div>
    </div> 
    <asp:Label ID="lblMsg" runat="server"></asp:Label>
        <div id="divprint" runat="server">
            <asp:GridView ID="grdDisplay" Width="100%" runat="server" AutoGenerateColumns="false"
                CssClass="gridview" AllowPaging="true" DataKeyNames="INVOICEID,TRANID" AlternatingRowStyle-CssClass="gridview_alternate"
                PagerStyle-CssClass="pgr" OnPageIndexChanging="grdDisplay_OnPageIndexChanging" PageSize="10"
                RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowCommand="grdDisplay_RowCommand"
                OnRowDataBound="grdDisplay_RowDataBound" OnRowCreated="grdDisplay_RowCreated"
                OnSelectedIndexChanged="grdDisplay_SelectedIndexChanged">
                <Columns>
                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                           <asp:Label ID="lblsno" runat="server" Text='<%# Container.DataItemIndex+1 %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Bill No." DataField="billno" />
                    <asp:BoundField HeaderText="Customer" DataField="Customer" />
                    <asp:BoundField HeaderText="Reference No." DataField="refno" />
                    <asp:BoundField HeaderText="Date" DataField="VOUDATE" DataFormatString="{0:dd-MMM-yyyy}" />
                    <asp:BoundField HeaderText="Grand Total" DataField="TotalAmt" ItemStyle-HorizontalAlign="Right" />
                    <asp:TemplateField HeaderText="View Type">
                        <ItemTemplate>
                            <asp:DropDownList ID="ddlChoice" runat="server" CssClass="dropdown">
                                <asp:ListItem Selected="True" Text="-Select-" Value="0"></asp:ListItem>
                                <asp:ListItem Selected="false" Text="Original" Value="1"></asp:ListItem>
                                <asp:ListItem Selected="False" Text="Duplicate" Value="2"></asp:ListItem>
                                <asp:ListItem Selected="False" Text="Triplicate" Value="3"></asp:ListItem>
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:HyperLink ID="hyperView" runat="server" NavigateUrl="#">View</asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                   <%-- <asp:TemplateField>
                    <ItemTemplate>
                     <asp:LinkButton ID="lkbtnpdf" runat="server" CausesValidation="false" CommandName="printpdf" CommandArgument='<%#Eval("INVOICEID") + "," + Eval("TRANID") %>' ToolTip="Export To PDF"><img src="../../Images/PDF.png" width="16" height="16" /> </asp:LinkButton>
                    </ItemTemplate>
                    </asp:TemplateField>--%>
                    <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkEdit" CommandArgument='<%#Eval("INVOICEID") + "," + Eval("TRANID") %>'
                                CommandName="editsi" runat="server" Font-Underline="false"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                <span style="font-weight:bold; color:Red;">Record Now Found !</span>
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
    </div>
       <asp:Panel ID="pnlpdf" runat="server" Visible="false" >
    <div style="width: 90%; height: 100%; margin-left: 5%; margin-right: 5%;">
    
    <span style="padding-left:88%;"><asp:Label ID="lblViewType" runat="server"></asp:Label></span>
     <table width="100%" class="tablecontent" cellpadding="0" border="1" cellspacing="0" style="margin:0;">
            <tr style="height: 0%;" >
                <td colspan="12" align="center" style="border-bottom:solid 1px;">
                    <b><asp:Label ID="lblCaption" runat="server"></asp:Label></b>
                </td>
            </tr>
            <tr style="height: 5%; border-bottom:solid 1px;">
                <td colspan="6" align="left" style="width: 50%; border-bottom:solid 1px; border-right:solid 1px;">
                    <b>Invoice To</b><br />
                    <asp:Label ID="lblInvoiceTo" runat="server"></asp:Label><br />
                    <br />
                </td>
                <td colspan="3" align="left" style="width: 25%; padding-left:0; border-bottom:solid 1px; border-right:solid 1px; vertical-align:top;">
                    &nbsp;<b>Bill No.&nbsp;&nbsp;</b><asp:Label ID="lblBillNo" runat="server"></asp:Label><br /><br />
                    <hr />
                     &nbsp;<b>Ref. No.</b>&nbsp;&nbsp;<asp:Label ID="lblRefNo" runat="server"></asp:Label>
                </td>
                <td colspan="3" align="left" style="width: 25%;  padding-left:0; border-bottom:solid 1px; vertical-align: top;">
                    &nbsp;<b>Date&nbsp;&nbsp;</b><asp:Label ID="lblDate" runat="server"></asp:Label><br /><br />
                    <hr />
                </td>
            </tr>
            <tr style="height: 10%;">
                <td colspan="5" align="left" style="width: 45%;">
                    <asp:Label ID="lblSupplier" runat="server"></asp:Label><br />
                    <br />
                </td>             
                <td align="right" style="width:5%;overflow:hidden; border-right:solid 1px;">
            &nbsp;<asp:Image ID="imgLogo" runat="server" Width="1.26729in" Height="1in"/>
                </td>
                <td colspan="3" align="left" style="width: 25%;">
              <br />&nbsp;<asp:Label id="lblCompVat" runat="server" Text="Company's VAT TIN"></asp:Label> <br /> <br />
                  
                    &nbsp;<asp:Label ID="lblCompServ" runat="server" Text="Company's Service Tax No."></asp:Label><br /><br />
                   
                    &nbsp;<asp:Label ID="lblCompPAN" runat="server" Text="Company's PAN"></asp:Label><br /><br />
                   
                    &nbsp;<asp:Label ID="lblBuyr" runat="server" Text="Buyer's VAT TIN/Sales Tax No." Visible="false"></asp:Label><br />
                </td>
                <td colspan="3" align="left" style="width: 25%;">
                   <br /><asp:Label ID="lblVATTIN" runat="server"></asp:Label><br /><br />
                    
                    <asp:Label ID="lblServiceTaxNo" runat="server"></asp:Label><br /><br />
                   
                    <asp:Label ID="lblPanNo" runat="server"></asp:Label><br /><br />
                   
                    <asp:Label ID="lblBuyrsVATSalesTaxNo" runat="server" Visible="false"></asp:Label><br />
                </td>
            </tr>
            <tr style="height: 0%; vertical-align: top;" align="left">
                <td colspan="12" align="left" style="height: 0%; padding:0 0 0 0; border-color:#d6d3ce; width:100%;"  >
                    <table id="tblDetail" runat="server" width="100%">
                        <tr >
                            <td style="width: 5%;border-color:#d6d3ce; border:solid 1px;border-left:0px white; ">
                                <b>S.No.</b>
                            </td> 
                            <td id="tdNature" runat="server" style="width: 17%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Nature of Service</b>
                            </td>
                            <td id="tdUnit" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Unit</b>
                            </td>
                            <td id="tdQty" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Qty.</b>
                            </td>
                            <td id="tdRate" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Rate</b>
                            </td>
                            <td id="tdGrossAmt" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Gross Amt.</b>
                            </td>
                            <td id="tdST" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>S.T.</b>
                            </td>
                            <td id="tdHE" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>HE Cess</b>
                            </td>
                            <td id="tdPE" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>PE Cess</b>
                            </td>
                            <td id="tdServ" runat="server" style="width: 10%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Serv. Chrg.</b>
                            </td>
                            
                            <td id="tdDis" runat="server" style="width: 7%;border-color:#d6d3ce;border:solid 1px;">
                                <b>Discount</b>
                            </td>
                            <td id="tdTotal" runat="server" style="width: 12%; border-color:#d6d3ce;border:solid 1px;border-right:0px white;">
                                <b>Total Amt.</b>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr style="height: 3%;">
                <td colspan="11" style="width: 95%; border:solid 1px;" align="right">
                    <b>Grand Total:</b>
                </td>
                <td style="width: 5%; border:solid 1px;" align="right">
                    <asp:Label ID="lblGrandTotal" runat="server"></asp:Label>
                </td>
            </tr>
            <tr style="height: 2%;">
              <td colspan="11" align="left" style="width: 82%; border-right-style:hidden;">
                    &nbsp;<b><asp:Label ID="lblRemarksHead" runat="server" Text="Remarks : "></asp:Label></b><asp:Label ID="lblRemarks" runat="server"></asp:Label>
               </td>
              <td style="width: 18%; vertical-align: top;" align="right">
                    E. & O.E.
                </td>
               </tr>
            <tr style="height: 3%;">
              <td colspan="12" align="left" style="width: 82%;">
                    &nbsp;<b><asp:Label ID="lblNarrHead" runat="server" Text="Narration : "></asp:Label></b><asp:Label ID="lblNarration" runat="server"></asp:Label>
               </td>
             </tr>
            <tr style="height: 5%;">
                <td colspan="12" align="left" style="width: 82%;">
                    <br />
                    <b>&nbsp;</b><br />
                    <asp:Label ID="lblAmountInWords" runat="server"></asp:Label><br />
                    <br />
                    <br />
                </td>
            </tr>
            <tr style="height: 10%;">
                <td colspan="3" align="left" style="width: 25%; border-bottom:solid 1px;" >
              <br />&nbsp;<asp:Label id="lblpreparedbyHead" runat="server" Text="Prepared By" Width="95%"></asp:Label> <br /> <br />
                  
                    &nbsp;<asp:Label ID="lblservicedbyHead" runat="server" Text="Serviced By" Width="95%"></asp:Label><br /><br />
                   
                    &nbsp;<asp:Label ID="lblcheckedbyHead" runat="server" Text="Checked By" Width="95%"></asp:Label><br /><br />
                </td>
                <td colspan="3" align="left" style="width: 25%; border-bottom:solid 1px;">
                   <br /> <asp:Label ID="lblpreparedby" runat="server" Width="95%"></asp:Label><br /><br />
                    
                    <asp:Label ID="lblservicedby" runat="server" Width="95%"></asp:Label><br /><br />
                   
                    <asp:Label ID="lblcheckedby" runat="server" Width="95%"></asp:Label><br /><br />
                </td>
                <td colspan="6" style="width: 50%; border:solid 1px;" align="right">
                    for&nbsp;<b><asp:Label ID="lblInvoiceFor" runat="server"></asp:Label></b>
                    <br />
                    <br />
                    <br />
                    <br />
                    <br />
                    Authorised Signatory<br />
                    <br />
                </td>
            </tr>
            <tr style="height: 3%;">
                <td colspan="12" style="width: 100%; border-top:solid 1px;" align="center">
                    This is a Computer Generated Sales Invoice.
                </td>
            </tr>
        </table>
    </div>
   </asp:Panel>
   <asp:Label ID="lbldata" runat="server"></asp:Label>
    </form>
</body>
</html>
